Don't traverse beyond the toplevel of the passed in window.
authorRichard Hult <richard@imendio.com>
Mon, 28 May 2007 20:24:59 +0000 (20:24 +0000)
committerRichard Hult <rhult@src.gnome.org>
Mon, 28 May 2007 20:24:59 +0000 (20:24 +0000)
2007-05-28  Richard Hult  <richard@imendio.com>

* gdk/quartz/gdkevents-quartz.c
(find_window_interested_in_event_mask): Don't traverse beyond the
toplevel of the passed in window.

svn path=/trunk/; revision=17967

ChangeLog
gdk/quartz/gdkevents-quartz.c

index 609907320cf71e04f7092a28e125e5d954e31dc1..4562e51a4fea437b63d42af118e78961ab6b9833 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-05-28  Richard Hult  <richard@imendio.com>
+
+       * gdk/quartz/gdkevents-quartz.c
+       (find_window_interested_in_event_mask): Don't traverse beyond the
+       toplevel of the passed in window.
+
 2007-05-28  Richard Hult  <richard@imendio.com>
 
        * gdk/quartz/gdkwindow-quartz.c: (_gdk_windowing_window_init): Set
index 45455cca7e2ae404d509320a8fb5fc7fdabc3637..012adcced87175361272d73f5a3064818eaf7fd8 100644 (file)
@@ -300,26 +300,32 @@ apply_filters (GdkWindow  *window,
   return result;
 }
 
-/* This function checks if the passed in window is interested in the
- * event mask. If so, it's returned. If not, the event can be propagated
- * to its parent.
+/* Checks if the passed in window is interested in the event mask, and
+ * if so, it's returned. If not, the event can be propagated through
+ * its ancestors until one with the right event mask is found, up to
+ * the nearest toplevel.
  */
 static GdkWindow *
-find_window_interested_in_event_mask (GdkWindow   *window, 
-                                     GdkEventMask event_mask,
-                                     gboolean     propagate)
+find_window_interested_in_event_mask (GdkWindow    *window, 
+                                     GdkEventMask  event_mask,
+                                     gboolean      propagate)
 {
-  while (window)
-    {
-      GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
+  GdkWindowObject *private;
 
+  private = GDK_WINDOW_OBJECT (window);
+  while (private)
+    {
       if (private->event_mask & event_mask)
-       return window;
+       return (GdkWindow *)private;
 
       if (!propagate)
        return NULL;
-      else
-       window = GDK_WINDOW (private->parent);
+
+      /* Don't traverse beyond toplevels. */
+      if (GDK_WINDOW_TYPE (private) != GDK_WINDOW_CHILD)
+       break;
+
+      private = private->parent;
     }
 
   return NULL;